using namespace std;
#include"automatics.h"
#include"regex_parser_test.h"
#include"parser.h"
#include"gen.h"
int main()
{
	ifstream test_file("cpp_tokenizers_script.tgs", ios::binary);
	filebuf *pbuf;
	pbuf = test_file.rdbuf();
	auto file_size = pbuf->pubseekoff(0, ios::end, ios::in);
	pbuf->pubseekpos(0, ios::in);
	char* buffer = new char[file_size];
	pbuf->sgetn(buffer, file_size);
	cout << file_size << endl;
	string raw_msg(buffer, file_size);
	u16string msg = utf8_to_utf16(raw_msg);
	cout << "Total File Size In MEMORY:" << sizeof(char) * raw_msg.capacity() << endl;
	cout << "Translate File Size In MEMORY:" << sizeof(char16_t) * msg.capacity() << endl;
	ofstream output("output.hxx");
	TokzrGentrParser parser;
	auto r = parser.Parse(msg);
	if (parser.IsFail())
		printf("fail parsing fuck!\n");
	else
	{
		code_gen gen;
		output << utf16_to_utf8(gen.CodeGen(r.get()));
	}
	system("pause");
}